/*content_left icon旋转*/
$('#content_left ul li').mouseover(function(){
	$(this).find('img').css({'-webkit-transform':'rotate(-30deg)','-moz-transform':'rotate(-30deg)','-o-transform':'rotate(-30deg)'});
	});
$('#content_left ul li').mouseout(function(){
	$(this).find('img').css({'-webkit-transform':'rotate(0deg)','-moz-transform':'rotate(0deg)','-o-transform':'rotate(0deg)'});
	});
/****************************/

$('#content_left ul li').click(function(){
	$('#content_left ul li').removeClass('content_left_select');
	$(this).addClass('content_left_select');
	});
	
$('#content_middle_top ul li').click(function(){
	var index = $('#content_middle_top ul li').index(this);
	var height = $('#content_middle').height();
	$('#content_middle_top ul li').removeClass('content_middle_top_select');
	$('#content_middle_select').animate({left:120+97*index});
	$(this).addClass('content_middle_top_select');
	$('#menu_line').css('height',height);
	});

/*已定食品列表操作*/
$('#content_right_middle ul li').live('mouseover',function(){
	$('#content_right_middle ul li').removeClass('content_right_middle_select');
	$('#content_right_middle ul li').find('img').removeClass('delete_select');
	$(this).addClass('content_right_middle_select');
	$(this).find('img').addClass('delete_select');
	});
$('#content_right_middle ul li').live('mouseout',function(){
	$('#content_right_middle ul li').removeClass('content_right_middle_select');
	$('#content_right_middle ul li').find('img').removeClass('delete_select');
	});
$('.delete_select').live('click',function(){
	$(this).parent().remove();
	})
	
/*注册*/
$('#regist_link').click(function(){
	
	})
	
	
	
/*订餐按钮效果*/
$('.ding').click(function(){
	var food_name = $(this).parent().find('ul li:eq(0)').text().substring(3);
	$('#content_right_middle ul').append('<li><a>'+food_name+'</a><img src="images/delete.gif" style="visibility:hidden"/></li>');
	});
$('.ding').mouseover(function(){
	 $(this).animate({height:50,width:50},50);
	});
$('.ding').mouseout(function(){
	$(this).animate({height:40,width:40},50);
	});
$('.ding').mousedown(function(){
	$(this).attr('src','images/ding2.gif');
	});
$('.ding').mouseup(function(){
	$(this).attr('src','images/ding.gif');
	});

/*智能定位*/
$.fn.smartFloat = function() {
	var position = function(element) {
		var top = element.position().top, pos = element.css("position");
		$(window).scroll(function() {
			var scrolls = $(this).scrollTop();
			if (scrolls > top) {
				if (window.XMLHttpRequest) {
					element.css({
						position: "fixed",
						top: 0
					});	
				} else {
					element.css({
						top: scrolls
					});	
				}
			}else {
				element.css({
					position: pos,
					top: top
				});	
			}
		});
};
	return $(this).each(function() {
		position($(this));						 
	});
};
//绑定
$("#content_right").smartFloat();

